import numpy as np
import matplotlib.pyplot as plt
a = np.loadtxt('fft_ave_sum1.txt')
b = np.loadtxt('fft_ave_sum2.txt')

n = 132000
timestep = 0.01 # in ps


R = 100
x = a[:,0].reshape(-1, R).mean(axis=1)
a_bin = a[:,1].reshape(-1, R).mean(axis=1)
b_bin = b[:,1].reshape(-1, R).mean(axis=1)


plt.plot(x[1:],a_bin[1:]*5)
plt.plot(x[1:],b_bin[1:])
plt.xlim(0,80)
plt.ylim(0,)
plt.xticks([0,20,40,60,80])
#plt.yticks([0,500,1000,1500])
plt.minorticks_on()
plt.xlabel('Energy (meV)',fontsize=20)
plt.ylabel('Power spectrum',fontsize=20)
#plt.legend(['Type1','Type2'],fontsize=20,frameon=False,loc='lower right')
plt.tick_params(which='both',direction='in',labelsize=20)
plt.savefig('AngleFFT.png',format='png',dpi=300,bbox_inches='tight')
plt.show()

